#include "../include/battery.h"

// 构造函数定义
Battery::Battery(const std::string &parameters, float outputVoltage, float chargeTimeHours)
    : parameters(parameters), outputVoltage(outputVoltage), chargeTimeHours(chargeTimeHours) {}

Battery::Battery(): Battery("24V/15Ah", 24, 2) {}

// 将属性写入文件的方法
void Battery::writeToFile(std::ofstream &file) {
    if (file.is_open()) {
        file << "电池：" << std::endl;
        file << " parameters: " << parameters << std::endl;
        file << " outputVoltag: " << outputVoltage << std::endl;
        file << " chargeTimeHours: " << chargeTimeHours << std::endl;
    }
}

// 打印属性的方法
void Battery::print() const {
    std::cout << "电池：" << std::endl;
    std::cout << " parameters: " << parameters << std::endl;
    std::cout << " outputVoltag: " << outputVoltage << std::endl;
    std::cout << " chargeTimeHours: " << chargeTimeHours << std::endl;
}